{% set pypi_name = 'ceilometermiddleware' %}
{% set upstream_version = upstream_version('2.1.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        A library for metric and event data generation for Ceilometer
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/ceilometermiddleware/latest/
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('betamax') }}
BuildRequires:  {{ py3('keystoneauth1') }}
BuildRequires:  {{ py3('python-keystoneclient') }}
BuildRequires:  {{ py3('mock') }}
BuildRequires:  {{ py3('oslo.config') }}
BuildRequires:  {{ py3('oslo.messaging') }}
BuildRequires:  {{ py3('oslo.utils') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('pycadf') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('testrepository') }}
Requires:       {{ py3('keystoneauth1') }}
Requires:       {{ py3('python-keystoneclient') }}
Requires:       {{ py3('oslo.config') }}
Requires:       {{ py3('oslo.messaging') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('pbr') }}
Requires:       {{ py3('pycadf') }}
Requires:       {{ py3('six') }}
BuildArch:      noarch

%description
This library provides middleware modules designed to enable metric and
event data generation to be consumed by Ceilometer.

%package doc
Summary:        Documentation for %{name}
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}

%description doc
This library provides middleware modules designed to enable metric and
event data generation to be consumed by Ceilometer.

This package contains documentation in HTML format.

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%py3_build

# generate html docs
PBR_VERSION={{ upstream_version }} %sphinx_build -b html doc/source doc/build/html
# remove the Sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%check
%{__python3} -m stestr.cli run

%install
%py3_install

%files
%license LICENSE
%doc README.rst
%{python3_sitelib}/{{ pypi_name }}
%{python3_sitelib}/{{ pypi_name }}-*.egg-info

%files doc
%license LICENSE
%doc doc/build/html

%changelog
